﻿@using PagedList
@using Web.Base.Extensions
@using Web.Base.Components
@using Ayatta.Contract.Domain
@using Ayatta.Common.Extensions
@helper GetHtml(IPagedList<Order> orders)
    {
    <table class="ui-table ui-table-inbox ui-table-alpha">
        <thead>
            <tr>
                <th style="width: 250px;">
                    商品信息
                </th>
                <th>
                    单价(元)
                </th>
                <th>
                    数 量
                </th>
                <th>
                    售 后
                </th>
                <th>
                    实付款(元)
                </th>
                <th>
                    订单状态
                </th>
                <th>
                    操 作
                </th>
            </tr>
        </thead>
        @orders.Each(@<tbody class="@(item.Item.Status == OrderStatus.Pending ? "item-pending" : "item")">
            <tr class="item-header">
                <td colspan="7" class="text-align-left">
                    <div style="line-height: 21px;">
                        <input type="checkbox" class="checkbox" value="@(item.Item.Id)" style="margin: 0;"/>
                        <span style="margin-left: 5px;">订单编号：@(item.Item.Id)</span> <span style="margin-left: 20px;">
                            成交时间：@(item.Item.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</span> <span style="margin-left: 20px;">@(item.Item.BuyerNick)</span>
                        <span class="pull-right"><a href="javascript:void(0);" data-rel="popover" data-toggle="popover"
                                                                                            data-trigger="hover" data-placement="left" data-title="备 忘" data-content="@(item.Item.BuyerMemo.IsNullOrEmpty() ? "暂时没有备忘信息！" : item.Item.BuyerMemo)">
                            <i class="icon-flag" style="color: red;"></i></a></span>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="col">
                    <div class="media">
                        <a class="pull-left" href="" target="_blank">
                            <img data-src="holder.js/64x64" class="media-object" alt="64x64" style="width: 64px;
                                height: 64px;" src="">
                        </a>
                        <div class="media-body">
                            <h5 class="media-heading">
                            </h5>
                            <p>
                            </p>
                        </div>
                    </div>
                </td>
                <td class="col">
                    @(item.Item.SubTotal.ToString("N"))
                </td>
                <td class="col">
                    @(item.Item.Quantity)
                </td>
                <td class="col">
                </td>
                <td class="col">
                    <p>
                        <strong>@(item.Item.Total.ToString("N"))</strong></p>
                    @if (item.Item.Postage == 0)
                    {
                        <p>
                            <span>免运费</span></p>
                    }
                    else
                    {
                        <p>
                            <span>含快递：@(item.Item.Postage.ToString("N"))</span></p>
                    }
                    <p>
                        <span>订单优惠：@(item.Item.Discount.ToString("N"))</span></p>
                </td>
                <td class="col">
                    @if (item.Item.Status == OrderStatus.Pending || item.Item.Status == OrderStatus.WaitBuyerPay)
                    {
                        <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">待付款</a>

                    }

                    else if (item.Item.Status == OrderStatus.WaitSellerSend)
                    {
                        <p>
                            <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">已付款待发货</a>
                        </p>
                        <p>
                            <a>提醒商家发货</a></p>
                    }
                    else if (item.Item.Status == OrderStatus.SellerSendPart)
                    {
                        <p>
                            <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">部分发货</a>
                        </p>
                        <p>
                            <a>提醒商家发货</a></p>
                    }
                    else if (item.Item.Status == OrderStatus.WaitBuyerConfirm)
                    {
                        <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">已发货待确认</a>
                    }
                    else if (item.Item.Status == OrderStatus.Canceled)
                    {
                        <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">交易关闭</a>
                    }
                    else if (item.Item.Status == OrderStatus.Finished)
                    {
                        <a class="order-status" href="/order/detail/@(item.Item.Id)" target="_blank">交易成功</a>
                    }
                </td>
                <td class="ui-table-action">
                    @if (item.Item.Status == OrderStatus.Pending || item.Item.Status == OrderStatus.WaitBuyerPay)
                    {
                        if (item.Item.Status == OrderStatus.Pending)
                        {
                        <p>
                            <a href="/order/pay/@(item.Item.Id)" target="_blank" class="btn btn-danger">付 款</a></p>
                        }
                        else
                        {
                        <p>
                            <a href="@WebSite.Pay/order/?param=@(item.Item.Id)" target="_blank" class="btn btn-danger">
                                付 款</a></p>
                        }
                        <p>
                            <a data-trigger="modal" href="/order/cancel/@(item.Item.Id)" data-title="取消订单">取消订单</a></p>
                    }
                    else if (item.Item.Status == OrderStatus.WaitBuyerPay)
                    {
                        <a class="order-status" href="@(WebSite.Pay)/order/?param=@(item.Item.Id)" target="_blank">
                            付 款</a>
                    }
                    else if (item.Item.Status == OrderStatus.WaitBuyerPay)
                    {
                        <a href="@(WebSite.Pay)/order?param=@(item.Item.Id)"  target="_blank">付款</a>
                    }
                    <p>
                        <a data-trigger="modal" href="/order/memo/@(item.Item.Id)"
                                                                                data-title="备忘">备 忘</a>
                    </p>
                </td>
            </tr>
            <tr class="item-footer">
                <td colspan="7">
                </td>
            </tr>
        </tbody>)
    </table>
}